﻿{include file="/public/header" /}
<style type="text/css">
.normal_form .field_text{width:120px !important;}
.normal_form .input-text{width:240px;}
</style>
<div class="content-wraper full">
    <div class="back-breadcrumb">
        <a class="back-link-icon" href="javascript:history.back(-1);"><i class="iconfont iconRectangleCopy10"></i>返回上一页</a>&nbsp;&nbsp;/&nbsp;&nbsp;订单详情,ID:{$res['id'] ?? ''}
    </div>
    <div class="wrap-title" style="text-indent:15px;">
        <h4>{$res['title'] ?? ''}</h4>
    </div>
    <div class="normal-line"></div>
    <div style="margin-top:10px;">
        <div class="normal_form row-inline" style="width:750px;">
            <div class="row">
                <div class="field_text">订房人：</div>
                <input type="text" class="input-text" name="booker" value="{$res['booker'] ?? ''}" disabled />
            </div>
            <div class="row"> 
                <div class="field_text" style="width:100px">订房人：</div>
                <select class="z-select bkuid" name="bkuid" data-content="true" data-prompt="请选择..." data-style="width:167px">
                    <option value="">请选择...</option>
                </select>
                <div class="field_text" style="width:50px !important;position:absolute;margin-top:-3px;padding-left:3px;">
                    <button type="button" class="btn btn-primary" style="width:70px;height:28px !important;line-height:28px !important;">保存</button>
                </div>
            </div>
            <div class="row">
                <div class="field_text">计费时长：</div>
                <input type="text" class="input-text" name="bizmin" value="{$res['bizmin'] ?? ''}" disabled />
            </div>
            <div class="row">
                <div class="field_text">包厢钟费：</div>
                <input type="text" class="input-text" name="gamount" value="{$res['gamount'] ?? ''}" disabled />
            </div>
            <div class="row">
                <div class="field_text">备注：</div>
                <input type="text" class="input-text" name="desc" value="{$res['desc'] ?? ''}" disabled />
            </div>
            <!--
            <div class="row" style="display: none;">
                <div class="field_text">最低消费：</div>
                <input type="text" class="input-text" name="coperto" value="{$res['coperto'] ?? ''}" disabled />
            </div>
            <div class="row" style="width:700px;">
                <div class="field_text">小组ids：</div>
                <input type="text" class="input-text" name="teams" value="{$res['teams'] ?? ''}" disabled style="width:567px;" />
            </div>
            <div class="row" style="width:700px;">
                <div class="field_text">销售uids：</div>
                <input type="text" class="input-text" name="suids" value="{$res['suids'] ?? ''}" disabled style="width:567px;" />
            </div>
            -->
            <div class="row" style="width:700px;">
                <div class="field_text">销售花名：</div>
                <input type="text" class="input-text" name="salname" value="{$res['salname'] ?? ''}" disabled style="width:570px;" />
            </div>
            <div class="row">
                <div class="field_text">状态：</div>
                <div class="labelrow">
                    <!--{if !($res['payment'] ?? 0)}-->
                    <label class="l-checkbox"><input type="checkbox" name="payment" value="0" {if !($res['payment'] ?? 0)} checked{/if} disabled /><i></i><span>使用中</span></label>
                    <!--{else}-->
                    <label class="l-checkbox"><input type="checkbox" name="payment" value="1" {if ($res['payment'] ?? 0)} checked{/if} disabled /><i></i><span>已结账</span></label>
                    <!--{/if}-->
                </div>
            </div>
        </div>
    </div>
    <div style="line-height:30px;">销售信息</div>
    <div class="normal-line"></div>
    <div class="tools-bar">
        <a data-key="rejected"><i class="fa fa-fw fa-reply"></i> 退台</a>
        <a data-key="salerout"><i class="fa fa-check-circle"></i> 下台</a>
        <a data-key="duration"><i class="fa fa-edit"></i> 修改时长</a>
    </div>
    <div class="table_box">
        <table class="table_main" id="kordersaler"></table>
    </div>
    <div style="line-height:30px;">房态信息</div>
    <div class="normal-line"></div>
    <div class="table_box">
        <table class="table_main" id="itinerary"></table>
    </div>
</div>
<script type="text/javascript">
Core.Easyui.FieldColumn = [
    {field:'ck',checkbox:true,width:30},
    {field:'id',title:'ID',width:50,align:'center'},
    {field:'uid',title:'UID',width:100,align:'center'},
    {field:'nickname',title:'销售',width:220,align:'left'},
    {field:'grade',title:"钟费/小时",width:100,align:'center'},
    {field:'juice',title:"特饮费/小时",width:100,align:'center'},
    {field:'trial',title:"免费时长",width:100,align:'center'},
    {field:'duration',title:"服务时长",width:100,align:'center'},
    {field:'vmin',title:"修改时长",width:80,align:'center'},   
    {field:'gamount',title:"总计钟费",width:100,align:'center'},
    {field:'amount',title:"总特饮费",width:100,align:'center'},
    {field:'paymentname',title:"支付情况",width:100,align:'center'},
    {field:'etime',title:"离开时间",width:130,align:'center'},
    {field:'stime',title:"加入时间",width:130,align:'center'},   
    {field:'deptype',title:"离开方式",width:80,align:'center',formatter:function(value,row,index){
        return ['','下台','退台'][value] || '';
	}}, 
    {field:'-',title:"",align:'left'},
];
Core.Easyui.init($("#kordersaler"),{
    url: "/korder.info/kordersaler/kid/{$res['id'] ?? 0}",
    idField: "id",
    height : 200,
    fitColumns: true,
    singleSelect : true,
    columns: [Core.Easyui.FieldColumn],
    pageSize: 50000,
    pageList: [10000, 50000, 100000],
});
Core.Easyui.FieldColumn = [
    {field:'ck',checkbox:true,width:30},
    {field:'content',title:'详情',align:'left'},
    {field:'dateline',title:"时间",width:130,align:'center'},
    {field:'-',title:"",align:'left'},
];
Core.Easyui.init($("#itinerary"),{
    url: "/korder.info/itinerary/kid/{$res['id'] ?? 0}",
    idField: "id",
    height : 200,
    fitColumns: true,
    singleSelect : true,
    columns: [Core.Easyui.FieldColumn],
    pageSize: 50000,
    pageList: [10000, 50000, 100000],
});
Core.Sys.Action = function(Tkey,row){
    switch(Tkey){
        case 'rejected':
            var row = $('#kordersaler').datagrid('getSelected');
            if (!row || !row.id) {Core.Dialog.msg('请选择对应销售');return;}
            if (row.etime){Core.Dialog.msg('该销售已离开，无需操作');return;}
            Core.Dialog.confirm({'title':"{$res['title'] ?? ''}退台",'content':"确定销售{$res['title'] ?? ''}退台吗？",'ok':function(cbk){
				$.get("/{$_G['_m_'] ?? ''}.ksaler/rejected/id/"+row.id+"?r="+Math.random(),function(data){
					$("#kordersaler").datagrid('reload');cbk();
				});
			}})
        break;
        case 'salerout':
            var row = $('#kordersaler').datagrid('getSelected');
            if (!row || !row.id) {Core.Dialog.msg('请选择对应销售');return;}
            if (row.etime){Core.Dialog.msg('该销售已离开，无需操作');return;}
            Core.Dialog.confirm({'title':"{$res['title'] ?? ''}下台",'content':"确定销售{$res['title'] ?? ''}下台吗？",'ok':function(cbk){
				$.get("/{$_G['_m_'] ?? ''}.ksaler/salerout/id/"+row.id+"?r="+Math.random(),function(data){
					$("#kordersaler").datagrid('reload');cbk();
				});
			}})
        break;case 'duration':
            var row = $('#kordersaler').datagrid('getSelected');
            if (!row || !row.id) {Core.Dialog.msg('请选择对应销售');return;}
            if (row.payment !=0) {Core.Dialog.msg('该销售已经结算特饮费，不允许再修改时长');return;}
            
            Core.Dialog.open({'title': "{$res['title'] ?? ''}修改时长:"+row.nickname,'width': '500px','height': '320px','url': "/{$_G['_m_'] ?? ''}.ksaler/duration/id/"+row.id});
        break;
    }
}
$(document).ready(function(){
    $('.tools-bar').find('a[data-key]').on('click',function(){
        var Tkey = $(this).attr('data-key');
        if (!Core.rule('key',Tkey)) return false;
        Core.Sys.Action(Tkey);
    });
});
</script>
{include file="/public/footer" /}